import http from '@/utils/request.js'
/**
 * 用户登录认证
 * @param {*} username
 * @param {*} password
 */
export const reqLogin = (username, password) => {
  return http({
    method: 'post',
    url: '/api/Login/login',
    data: {
      username,
      password
    }

  })
}
/**
 * 获取用户个人信息（编辑信息）
 */
export const reqGetProfile = () => {
  return http({
    method: 'get',
    url: '/app/v1_0/user/profile'
  })
}

/**
 * 关注用户
 * @param {*} userId
 */
export const reqFollowUser = (userId) => {
  return http({
    method: 'post',
    url: '/app/v1_0/user/followings',
    data: {
      target: userId
    }
  })
}

/**
 * 取消用户关注
 * @param {*} target
 */
export const reqUnFollowUser = (target) => {
  return http({
    method: 'delete',
    url: `/app/v1_0/user/followings/${target}`
  })
}

/**
 * 获取用户个人信息
 */
export const reqGetUserInfo = () => {
  return http({
    method: 'get',
    url: '/app/v1_0/user'
  })
}

export const reqUpdateUserInfo = (obj) => {
  return http({
    method: 'patch',
    url: '/app/v1_0/user/profile',
    data: obj
  })
}

export const reqUpDatePhoto = (formDate) => {
  return http({
    method: 'patch',
    url: '/app/v1_0/user/photo',
    data: formDate
  })
}
